import { _decorator, Component, director, Node } from 'cc';
import { GameManager } from './GameManager';
const { ccclass, property } = _decorator;

@ccclass('GameUIController')
export class GameUIController extends Component {
    @property(Node)
    gameStartUI: Node = null;

    // @property(Node)
    // gameUI: Node = null;

    @property(Node)
    gameOverUI: Node = null;

    @property(GameManager)
    gameManager:GameManager=null

    // 点击开始按钮，隐藏游戏开始面板和结束面板
    onClickStartGameButton() {
    
        this.gameStartUI.active = false;
        this.gameOverUI.active = false;
        this.gameManager.onClickStartButton();
    }

   

    // 点击重新开始按钮，隐藏游戏开始面板和结束面板，小鸟回到初始位置，分数归零
    onClickRestartGameButton() {
    //    director.loadScene('main_scene');
       this.gameStartUI.active = false;
       this.gameOverUI.active = false;
       this.gameManager.onRestartGame();
       
    }

    // 点击复活按钮，隐藏游戏开始面板和结束面板
    onClickreviveButton() {
        this.gameStartUI.active = false;
        this.gameOverUI.active = false;
        this.gameManager.revive();
    }
}
